using EasyAdmin.Admin.Entity.Entities;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace EasyAdmin.Admin.Application.Services
{
    public interface ISysUserService
    {
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>登录结果，包含Token</returns>
        Task<(bool Success, string Token, string Message)> LoginAsync(string username, string password);

        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="user">用户信息</param>
        /// <returns>创建结果</returns>
        Task<(bool Success, string Message)> CreateUserAsync(SysUser user);

        /// <summary>
        /// 更新用户信息
        /// </summary>
        /// <param name="user">用户信息</param>
        /// <returns>更新结果</returns>
        Task<(bool Success, string Message)> UpdateUserAsync(SysUser user);

        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>删除结果</returns>
        Task<(bool Success, string Message)> DeleteUserAsync(int userId);

        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns>用户信息</returns>
        Task<SysUser> GetUserByIdAsync(int userId);

        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <param name="keyword">关键字</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        Task<(List<SysUser> Items, int Total)> GetUserListAsync(string keyword = "", int pageIndex = 1, int pageSize = 10);

        /// <summary>
        /// 获取用户角色
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <returns></returns>
        Task<List<SysRole>> GetUserRolesAsync(int userId);

        /// <summary>
        /// 设置用户角色
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="roleIds">角色ID列表</param>
        /// <returns></returns>
        Task<(bool Success, string Message)> SetUserRolesAsync(int userId, List<int> roleIds);
    }
}